package com.zy.openchat.util;

import android.text.NoCopySpan;
import android.text.TextPaint;
import android.text.style.ClickableSpan;
import android.view.View;

import androidx.annotation.NonNull;

public class NoRefCopySpan extends ClickableSpan implements NoCopySpan {

    private View.OnClickListener clickListener;

    public NoRefCopySpan(View.OnClickListener clickListener) {
        this.clickListener = clickListener;
    }

    @Override
    public void onClick(@NonNull View widget) {
        if(clickListener!=null){
            clickListener.onClick(widget);
        }
    }

    @Override
    public void updateDrawState(@NonNull TextPaint ds) {
        super.updateDrawState(ds);
        ds.setUnderlineText(false);
    }
}
